/**
 * 封装不同类型的restful请求
 */

import request from './request'


// 全局要用的类型放到这里



export default {
	get: async (options) => {
		const res = await request({
			method: 'GET',
			...options
		})
		return res
	},
	post: async (option) => {
		const res = await request({
			method: 'POST',
			...option
		})
		return res
	},
	postOriginal: async (option) => {
		const res = await request({
			method: 'POST',
			...option
		})
		return res
	},
	delete: async (option) => {
		const res = await request({
			method: 'DELETE',
			...option
		})
		return res
	},
	put: async (option) => {
		const res = await request({
			method: 'PUT',
			...option
		})
		return res
	},
	download: async (option) => {
		const res = await request({
			method: 'GET',
			responseType: 'blob',
			...option
		})
		return res
	},
	upload: async (option) => {
		option.headersType = 'multipart/form-data'
		const res = await request({
			method: 'POST',
			...option
		})
		return res
	},
}